﻿using System;
using System.IO;
using System.Collections.Specialized;
using System.Text;

namespace NeroConnect.Network
{
	/// <summary>Describes an incoming HTTP request to an IListener object.</summary>
	public interface IListenerRequest
	{
		/// <summary>Gets the System.Uri object requested by the client.</summary>
		/// <value>A System.Uri object that identifies the resource requested by the client.</value>
		Uri Url { get; }
		/// <summary>Gets the URL information (without the host and port) requested by the client.</summary>
		/// <value>A System.String that contains the raw URL for this request.</value>
		[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
		string RawUrl { get; }
		/// <summary>Gets a stream that contains the body data sent by the client.</summary>
		/// <value>A readable System.IO.Stream object that contains the bytes sent by the client in the body of the request. This property returns System.IO.Stream.Null if no data is sent with the request.</value>
		Stream InputStream { get; }
		/// <summary>Gets the HTTP method specified by the client.</summary>
		/// <value>A System.String that contains the method used in the request.</value>
		string HttpMethod { get; }
		/// <summary>Gets the collection of header name/value pairs sent in the request.</summary>
		/// <value>A System.Net.WebHeaderCollection that contains the HTTP headers included in the request.</value>
		NameValueCollection Headers { get; }
		/// <summary>Gets a System.Boolean value that indicates whether the request has associated body data.</summary>
		/// <value>true if the request has associated body data; otherwise, false.</value>
		bool HasEntityBody { get; }
		/// <summary>Gets the MIME type of the body data included in the request.</summary>
		/// <value>A System.String that contains the text of the request's Content-Type header.</value>
		string ContentType { get; }
		/// <summary>Gets the length of the body data included in the request.</summary>
		/// <value>The value from the request's Content-Length header. This value is -1 if the content length is not known.</value>
		long ContentLength64 { get; }
		/// <summary>Gets the content encoding that can be used with data sent with the request</summary>
		/// <value>An System.Text.Encoding object suitable for use with the data in the InputStream property.</value>
		Encoding ContentEncoding { get; }
		/// <summary>Gets the user agent presented by the client.</summary>
		/// <value>A System.String object that contains the text of the request's User-Agent header.</value>
		string UserAgent { get; }
		/// <summary>Gets the server IP address and port number to which the request is directed.</summary>
		/// <value>A System.String that contains the host address information.</value>
		string UserHostAddress { get; }
		/// <summary>Gets the DNS name and, if provided, the port number specified by the client.</summary>
		/// <value>Gets the DNS name and, if provided, the port number specified by the client.</value>
		string UserHostName { get; }
		/// <summary>Gets a System.Boolean value that indicates whether the request is sent from the local computer.</summary>
		/// <value>true if the request originated on the same computer as the IListener object that provided the request; otherwise, false.</value>
		bool IsLocal { get; }
		/// <summary>Gets a System.Boolean value that indicates whether the TCP connection used to send the request is using the Secure Sockets Layer (SSL) protocol.</summary>
		/// <value>true if the TCP connection is using SSL; otherwise, false.</value>
		bool IsSecureConnection { get; }
		/// <summary>Gets a System.Boolean value that indicates whether the client requests a persistent connection.</summary>
		/// <value>true if the connection should be kept open; otherwise, false.</value>
		bool KeepAlive { get; }
		/// <summary>Gets the client IP address and port number from which the request originated.</summary>
		/// <value>An System.Net.IPEndPoint that represents the IP address and port number from which the request originated.</value>
		System.Net.IPEndPoint RemoteEndPoint { get; }
		/// <summary>Get the server IP address and port number to which the request is directed.</summary>
		/// <value>An System.Net.IPEndPoint that represents the IP address that the request is sent to.</value>
		System.Net.IPEndPoint LocalEndPoint { get; }
	}
}
